package com.qida.clm.core.network.response;

import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
import com.android.volley.VolleyError;
import com.qida.clm.core.network.MessageCode;

public class DelegateResponse implements ErrorListener, Listener<String> {
	
	private IResponse<?> mResponse;

	public <T> void setClientResponse(IResponse<T> response){
		this.mResponse = response;
	}

	@Override
	public void onErrorResponse(VolleyError error) {
		mResponse.processError(MessageCode.getResponseErrorByVolleyError(error));
	}

	@Override
	public void onResponse(String response) {
		mResponse.processResponse(response);
	}
}